package com.chen.script.feign;

import com.chen.common.feign.annotation.FeignOption;
import com.chen.root.base.R;
import com.chen.root.oclass.vo.FileStructureVO;
import feign.Request;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author ChenJinLong
 * @date 2023/6/25
 **/
@ConditionalOnProperty(value = "file.enable", havingValue = "true")
@FeignClient(name = "remoteFileService", url = "${file.url}")
public interface RemoteFileService {

    @FeignOption(readTimeout = 60 * 10)
    @PostMapping("/structure")
    @ApiOperation(value = "文件或文件夹结构",notes = "文件或文件夹结构")
    R<FileStructureVO> fileStructure(@RequestParam("parentDir") String parentDir, Request.Options options);

    @FeignOption(readTimeout = 60 * 20)
    @PostMapping("/md5")
    @ApiOperation(value = "计算文件MD5",notes = "计算文件MD5")
    R<String> md5(@RequestParam("filePath") String filePath, Request.Options options);

}
